package org.example.struct.array2;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author liyishan
 * @date 2024/7/15 10:06
 * @apiNote
 */

public class Test00721AccountsMerge {
    public List<List<String>> accountsMerge(List<List<String>> accounts) {
        Map<String,Integer> emailToIndex = new HashMap<>();
        Map<String,String> emailToName = new HashMap<>();
        int emailsCount = 0;
        for(List<String> account : accounts){
            String name = account.get(0);
            int size = account.size();
            for(int i = 1; i< size ;i++){
                String email = account.get(i);
                if(!emailToIndex.containsKey(email)){
                    emailToIndex.put(email,emailsCount++);
                    emailToName.put(email,name);
                }
            }
        }

        return null;

    }
}
